﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WithHookDemo
{
    class CoffeeWithHook:CaffeineBeverageWithHook
    {
        public CoffeeWithHook() { }
        public override void brew()
        {
            Console.WriteLine("driping coffee through filter");
        }

        public override void addCondiments()
        {
            Console.WriteLine("adding sugar and milk");
        }
        
        protected override bool customerWantsCondiments()
        {
            string ans = getUserInput();
            if(ans.ToLower().StartsWith("y"))
                return true;
            else
                return false;
        }

        private string getUserInput()
        {
            string ans = null;
            Console.WriteLine("would you like milk and sugar with your coffee (y/n)?");
            ans = Console.ReadLine();
            if (string.IsNullOrEmpty(ans))
                return "no";
            else
                return ans;
        }
    }
}
